<template>
    <div>
        <van-nav-bar title="我的订单" left-text="返回" left-arrow @click-left="onClickLeft" />
        <van-list v-model="loading" class="shangpin" :finished="finished" finished-text="" @load="onLoad">
            <div v-for="(list1, index) in list1" :key="index">
                <van-card :num="list1.buycount" :tag="list1.brand" :price="list1.price" :desc="list1.products"
                    :title="list1.proname" :thumb="list1.proimg" :origin-price="list1.comboporct" />
            </div>
        </van-list>  
    </div>
</template>

<script>
import axios from "axios";
export default {
    data() {
        return {
            show: "",
            list1: [

            ]
            ,
            list2: [],
            loading: false,
            finished: false,

        }
    },
    created() {
        this.getList();
    },
    methods: {
        onClickLeft() {
            this.$router.push({ path: '/friends' })
        },
        getList() {
            axios({
                url: "/api/user/getOrderList",
                method: "GET",
                params:{
                    userId:JSON.parse(localStorage.getItem('user')).userId,
                    orderType:1
                }
            }).then((res) => {
                this.list1=res.data;
                console.log(this.list1);
            });
        },
        onLoad() {
            // 异步更新数据
            // setTimeout 仅做示例，真实场景中一般为 ajax 请求
            setTimeout(() => {
                // // 加载状态结束
                // this.loading = false;

                // // 数据全部加载完成
                // if (this.list.length >= 40) {
                this.finished = true;
                // }
            }, 1000);
        },
    },
}
</script>

<style>

</style>